package com.haruhinav.mapper;

import com.haruhinav.entity.Wallpaper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

@Mapper
public interface WallpaperMapper {

    /**
     * 添加壁纸
     * @param wallpaper
     * @return
     */
    int insert(Wallpaper wallpaper);

    /**
     * 分页查询壁纸 pageSize 24
     * @param wallpaper
     * @return
     */
    List<Wallpaper> limitWallpaper(Wallpaper wallpaper);

    /**
     *  统计启用或者不启用的壁纸总数
     * @param wallpaper
     * @return
     */
    Integer countWallpaper(Wallpaper wallpaper);

    /**
     * 修改
     * @param wallpaper
     * @return
     */
    Integer updateWallpaper(Wallpaper wallpaper);

    /**
     * 根据id删除
     * @param id
     * @return
     */
    Integer deleteWallpaperById(@Param("id") Long id);

    /**
     * 批量删除by ids
     * @param ids
     * @return
     */
    Integer batchDeleteByIds(@Param("ids") long[] ids);

    /**
     * 根据ids获取
     * name , resize_name
     * @param ids
     * @return
     */
    List<Wallpaper> getWallpaperByIds(@Param("ids") long[] ids);

    /**
     * 批量审核/下架
     * @param ids
     * @return
     */
    Integer batchUpdateEnabled(@Param("ids") long[] ids);

    /***
     * 查询md5值相同的数据
     * @return
     */
    List<Wallpaper> getWallpaperGroupByMd5();
}
